<template>

  <data-table
    ref="pagingTable"
    :options="options"
    :list-query="listQuery"
  >
    <template slot="filter-content">
      <el-input v-model="listQuery.params.title" placeholder="搜索考试名称" style="width: 200px;" class="filter-item" />
    </template>

    <template slot="data-columns">

      <el-table-column
        label="考试名称"
        prop="title"
      />

      <el-table-column
        label="考试类型"
        align="center"
      >
        <template slot-scope="scope">
          {{ scope.row.openType | examOpenType }}
        </template>

      </el-table-column>

      <el-table-column
        label="考试时间"
        width="220px"
        align="center"
      >

        <template slot-scope="scope">
          <span v-if="scope.row.timeLimit">
            {{ scope.row.startTime }} ~ {{ scope.row.endTime }}
          </span>
          <span v-else>不限时</span>
        </template>

      </el-table-column>

      <el-table-column
        label="考试人数"
        prop="examUser"
        align="center"
      />

      <el-table-column
        label="待阅试卷"
        prop="unreadPaper"
        align="center"
      />

      <el-table-column
        label="操作"
        align="center"
        width="220px"
      >
        <template slot-scope="scope">
          <el-button type="primary" size="mini" icon="el-icon-finished" @click="handleUserListDetail(scope.row.id)">去批阅</el-button>
          <el-button type="warning" size="mini" icon="el-icon-more" @click="handleUserListDetail(scope.row.id)">考生列表</el-button>
        </template>
      </el-table-column>

    </template>

  </data-table>

</template>

<script>
import DataTable from '@/components/DataTable'

export default {
  name: 'ListRevise',
  components: { DataTable },
  data() {
    return {
      listQuery: {
        current: 1,
        size: 10,
        params: {
          title: ''
        }
      },

      options: {
        // 可批量操作
        multi: false,
        // 列表请求URL
        listUrl: '/exam/api/exam/exam/review-paging'
      }
    }
  },
  methods: {

    handleUserListDetail(examId) {
      this.$router.push({ name: 'reviseUserList', params: { id: examId }})
    }
  }
}
</script>
